/*
 * test_framework_util_threadpool.h
 *
 *  Created on: 2014. 6. 19.
 *      Author: jjaehuny
 */

#ifndef TDD_NFRAMEWORK_TEST_FRAMEWORK_UTIL_THREADPOOL_H_
#define TDD_NFRAMEWORK_TEST_FRAMEWORK_UTIL_THREADPOOL_H_

#include <thread>
#include <chrono>

#include <gtest/gtest.h>
#include <glog/logging.h>

#include <Framework/Util/StaticSingleton.h>
#include <Framework/Util/ThreadExecuter.h>

class test_framework_util_threadexecuter : public testing::Test
{
public:
	class Dummy : public ::Framework::Util::StaticSingleton<Dummy>
	{
	public:
		Dummy() {}
		~Dummy() {}

		void onThread()
		{
			LOG(INFO) << __PRETTY_FUNCTION__;
		}

		::Framework::Util::ThreadExecuter threadPool_;
	};

public:

	// Sets up the test fixture.
	virtual void SetUp() {}

	// Tears down the test fixture.
	virtual void TearDown() {}
};

TEST_F(test_framework_util_threadexecuter, test_framework_util_threadexecuter_success)
{
	Dummy * pDummy = new Dummy;

	Dummy::Instance().threadPool_.Run(3, std::bind(& Dummy::onThread, pDummy));
}



#endif /* TDD_NFRAMEWORK_TEST_FRAMEWORK_UTIL_THREADPOOL_H_ */
